﻿<UserControl x:Class="Epi.WPF.Dashboard.Controls.SpinCursor"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="300" Width="300">
    <UserControl.Resources>
        <Style x:Key="circle" TargetType="Ellipse">
            <!-- Width="80" Height="80" StrokeThickness="3" Stroke="White" -->
            <Setter Property="Width" Value="80"></Setter>
            <Setter Property="Height" Value="80"></Setter>
            <Setter Property="StrokeThickness" Value="3"></Setter>
            <Setter Property="Stroke" Value="White"></Setter>
        </Style>
        
        <Style x:Key="rectangle" TargetType="Rectangle">
            <Setter Property="Fill" Value="#5EA8DE"></Setter>
        </Style>
    </UserControl.Resources>
    <Viewbox>
        <Canvas Width="80" Height="80" Name="canvas" Background="#5EA8DE">
            <Canvas.RenderTransform>
                <RotateTransform Angle="0" CenterX="40" CenterY="40" />
            </Canvas.RenderTransform>
            <Canvas.Triggers>

                <EventTrigger RoutedEvent="FrameworkElement.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetName="canvas"
                      Storyboard.TargetProperty="(Canvas.RenderTransform).(RotateTransform.Angle)"
                      To="360"
                      Duration="0:0:0.5"
                      RepeatBehavior="Forever"/>
                            </Storyboard>

                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Canvas.Triggers>
            <Ellipse x:Name="circle" Canvas.Top="0" Canvas.Left="0" Style="{StaticResource circle}"/>
            <Rectangle x:Name="rectangle" Canvas.Bottom="0" Canvas.Right="0" Width="40" Height="40" Style="{StaticResource rectangle}"></Rectangle>
        </Canvas>
    </Viewbox>
</UserControl>
